<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>市平台财务统计管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/report/bsReportPay/">出入库金额统计</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsReportPay" action="${ctx}/report/bsReportPay/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>order_no：</label>
				<form:input path="orderNo" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>supplyorg_code：</label>
				<form:input path="supplyorgCode" htmlEscape="false" maxlength="11" class="input-medium"/>
			</li>
			<li><label>receiveorg_code：</label>
				<form:input path="receiveorgCode" htmlEscape="false" maxlength="11" class="input-medium"/>
			</li>
			<li><label>pay_type：</label>
				<form:input path="payType" htmlEscape="false" maxlength="2" class="input-medium"/>
			</li>
			<li><label>type：</label>
				<form:input path="type" htmlEscape="false" maxlength="2" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<!-- <th>收款单位</th> -->
				<th rowspan = "2">欠款单位</th>
				<th rowspan = "2">期初欠款</th>
				<th colspan = "6">本期发生</th>
				<th rowspan = "2">期末欠款</th>
				<!-- <th rowspan = "2">明细数量</th> -->
			</tr>
			<tr>
				<!-- <th>收款单位</th> -->
				<th colspan = "3">本期欠款</th>
				<th colspan = "3">本期回款</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${list}" var="total">
			<tr>
				<td rowspan = "${total.num + 1}">
					${total.receiveorgname}
				</td>
				<td  rowspan = "${total.num + 1}">
					${total.qcqk}
				</td>
				<td colspan = "3">
					合计：${total.bqqk}
				</td>
				<td colspan = "3">
					合计：${total.bqhk}
				</td>
				<td rowspan = "${total.num + 1}">
					${total.qmqk}
				</td>
			</tr>
			<c:forEach items="${detailList}" var="bsReportPay">
			<c:if test="${total.supplyorgcode== bsReportPay.supplyorgCode && total.receiveorgcode== bsReportPay.receiveorgCode}">
				<tr>
					<c:choose>
						<c:when test="${bsReportPay.payType== 1}">
							<td>
								${bsReportPay.payment}
							</td>
							<td>
								<fmt:formatDate value="${bsReportPay.payDate}" pattern="yyyy-MM-dd" />
							</td>
							<td>
								${bsReportPay.orderNo}
							</td>
							<td> - </td>
							<td> - </td>
							<td> - </td>
						</c:when>
						<c:when test="${bsReportPay.payType== 2}">
							<td> - </td>
							<td> - </td>
							<td> - </td>
							<td>
								${bsReportPay.payment}
							</td>
							<td>
								<fmt:formatDate value="${bsReportPay.payDate}" pattern="yyyy-MM-dd" />
							</td>
							<td>
								${bsReportPay.orderNo}
							</td>
						</c:when>
					</c:choose>
				</tr>
			</c:if>
		</c:forEach>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>